package com.seashop.controller;


import com.seashop.constant.UserRedisContants;
import com.seashop.redis.RedisZero;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 系统配置 前端控制器
 * </p>
 *
 * @author moredln
 * @since 2020-08-11
 */
@RestController
@RequestMapping("systemConfig")
@Slf4j
public class SystemConfigController {

    @Autowired
    private RedisZero redisZero;

    @GetMapping("/key/{key}")
    public String getSystemConfig(@PathVariable("key") String key) {
        String redisKey = UserRedisContants.PREFIX_SYSTEM_CONFIG + key;
        if(redisZero.exists(redisKey)){
            return redisZero.get(redisKey).toString();
        }
        return null;
    }

}

